package com.kadron.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.kadron.base.KBase;

@Entity
@Table(name = "k_user_newsletter", uniqueConstraints = { @UniqueConstraint(columnNames = {
		"user_id", "newsletter_id" }) })
public class UserNewsletter extends KBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -262080988176582888L;

	private long userId;
	private long newsletterId;
	
	private UserNewsletter() {
		super();
	}
	
	public UserNewsletter(long userId, long newsletterId) {
		this();
		this.userId = userId;
		this.newsletterId = newsletterId;
	}

	@Column(name = "user_id")
	public long getUserId() {
		return userId;
	}

	public void setUserId(long userId) {
		this.userId = userId;
	}

	@Column(name = "newsletter_id")
	public long getNewsletterId() {
		return newsletterId;
	}

	public void setNewsletterId(long newsletterId) {
		this.newsletterId = newsletterId;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserNewsletter other = (UserNewsletter) obj;
		if (id != other.id)
			return false;
		return true;
	}
}
